Skip to content

RISC-V 64-bit: rework assembly code. - #10893

Merged
JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
SparkiDev:riscv64_asm_1
Jul 16, 2026
Merged

RISC-V 64-bit: rework assembly code.#10893
JacobBarthelmeh merged 1 commit into
wolfSSL:masterfrom
SparkiDev:riscv64_asm_1

Conversation

@SparkiDev

Copy link
Copy Markdown
Contributor

Description

Assembly code generated from scripts.
Have separate assembly files and new inline code.

Testing

Regression tested RISC-V 64-bit.

@SparkiDev SparkiDev self-assigned this Jul 14, 2026
@SparkiDev
SparkiDev force-pushed the riscv64_asm_1 branch 3 times, most recently from 1de4600 to e82399f Compare July 14, 2026 06:23
@SparkiDev

SparkiDev commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins: retest this please

Valgrind

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reworks the RISC-V 64-bit crypto acceleration implementation by moving generated RISC-V assembly into standalone .S/helper C files and wiring the core C implementations (AES/SHA/Poly1305/ChaCha) to call the new RISC-V backends. It also updates the build system and configuration logic so autoconf/automake builds compile the new sources consistently (including AES-GCM streaming support).

Changes:

  • Replace prior RISC-V C/inline-asm implementations for SHA-256/SHA-3/Poly1305 (and related pieces) with generated standalone assembly plus helper C sources, and add new RISC-V transform hooks in SHA-256/SHA-512 core code.
  • Add/adjust public/internal headers for new RISC-V entry points (SHA-256/SHA-512 transforms, AES routines, Poly1305 layout + functions, ChaCha speedup macro).
  • Update build/config integration (include.am, configure.ac) to compile the new RISC-V sources and allow WOLFSSL_AESGCM_STREAM under RISC-V asm.

Reviewed changes

Copilot reviewed 21 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wolfssl/wolfcrypt/sha512.h Declares RISC-V SHA-512 transform entry points.
wolfssl/wolfcrypt/sha256.h Declares RISC-V SHA-256 transform entry points.
wolfssl/wolfcrypt/poly1305.h Aligns RISC-V Poly1305 struct layout with generic and updates RISC-V function prototypes.
wolfssl/wolfcrypt/libwolfssl_sources_asm.h Ensures generated asm sees consistent feature macros by including options.h in autoconf builds.
wolfssl/wolfcrypt/chacha.h Adds USE_RISCV_CHACHA_SPEEDUP and aligns buffer alignment requirements for RISC-V asm.
wolfssl/wolfcrypt/aes.h Declares RISC-V AES primitives, bulk modes, and AES-GCM helpers.
wolfcrypt/src/sha512.c Enables core SHA-512 code under RISC-V asm and dispatches transforms to RISC-V backends.
wolfcrypt/src/sha256.c Enables core SHA-256 code under RISC-V asm and dispatches transforms to RISC-V backends.
wolfcrypt/src/port/riscv64/riscv-64-sha3-asm.S Adds generated standalone RISC-V SHA-3 assembly implementation.
wolfcrypt/src/port/riscv/riscv-64-sha3.c Removes prior RISC-V SHA-3 C/inline-asm implementation.
wolfcrypt/src/port/riscv/riscv-64-sha256.c Removes prior RISC-V SHA-256 implementation.
wolfcrypt/src/port/riscv/riscv-64-poly1305.c Removes prior RISC-V Poly1305 implementation.
wolfcrypt/src/poly1305.c Routes Poly1305 key/final/block handling through new RISC-V entry points.
wolfcrypt/src/chacha.c Integrates RISC-V ChaCha speedup without excluding the C implementation wholesale.
wolfcrypt/src/aes.c Implements RISC-V AES block/key schedule hooks and adds RISC-V accelerated CBC/CTR/GCM/XTS paths (incl. streaming).
src/include.am Switches automake source lists from old port/riscv C files to new port/riscv64 generated asm sources.
configure.ac Enables AES-GCM streaming under RISC-V asm and adds zba option handling for RISC-V asm builds.
.wolfssl_known_macro_extras Adds WOLFSSL_RISCV_ASM_INLINE as a known macro extra.
.github/workflows/codespell.yml Adds vor to codespell ignore list (assembly mnemonic).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wolfcrypt/src/port/riscv64/riscv-64-sha3-asm.S
Comment thread wolfssl/wolfcrypt/aes.h Outdated
Comment thread wolfcrypt/src/port/riscv64/riscv-64-sha3-asm_c.c
Assembly code generated from scripts.
Have separate assembly files and new inline code.
@SparkiDev

SparkiDev commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Jenkins: retest this please

FIPS ready aborted

@JacobBarthelmeh JacobBarthelmeh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the versions I could using QEMU. Sections in generic wolfcrypt/src/*.c files are reviewed and isolated to RISCV builds. Thanks Sean.

@JacobBarthelmeh
JacobBarthelmeh merged commit 4e27e2c into wolfSSL:master Jul 16, 2026
339 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants